package com.example.euchre;

import java.util.Random;

import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

public class MainActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.activity_main, menu);
        return true;
    }
    
    public void start(View view)
    {
    	
    	int[][] cards = new int[24][3];
    	
    	deal(cards);
    	findTrump(cards);
    }

    
    public void findTrump(int[][] cards)
    {
    	TextView trump = (TextView) findViewById(R.id.trump);
    	TextView player = (TextView) findViewById(R.id.player);
    	Button pass = (Button) findViewById(R.id.pass);
    	Button pickUp = (Button) findViewById(R.id.pickUp);
    	
    	int j = 0;
    	for (int i=0; i < cards.length; i++)
    	{
    		
    	 if (cards[i][1] == 4)
    		{
    		 	trump.setText("Trump: " + Integer.toString(i));
    		 	break;
    		}
    	}
    	

    	while(j != 3)
    	{
    		player.setText("Player: " + (j + 1));
    			

				}
				
    		
    	}
    
    
	public static void deal(int[][] cards)
	{
	  	 
        Random randomGenerator = new Random();
        
        for (int i=0; i < cards.length; i++){
            
            int cardNumber = randomGenerator.nextInt(cards.length);
                    
            while (cards[cardNumber][2] == 1)
            {
                cardNumber = randomGenerator.nextInt(cards.length);
            }
            
            cards[cardNumber][2] = 1;    
            cards[cardNumber][1] = i % 4;
            
            if (i >= 20)
            {
            	cards[cardNumber][1] = 4;
            }
        }
	}
    
}
